package com.aptech.fpt.c0810g.newspj.dataaccess;

import com.aptech.fpt.c0810g.newspj.dataaccess.share.InvokeSelectQuery;
import com.aptech.fpt.c0810g.newspj.entity.Manager;
import java.util.ArrayList;
import java.util.HashMap;

/**
 *
 * @author zang
 */
public class LoginAction {

    public void doLogin(Manager user) {

        //Cac cot muon truy van
        ArrayList<String> colums = new ArrayList<String>();
        colums.add("UserName");
        //Cac dieu dien 
        ArrayList<String> codition = new ArrayList<String>();
        codition.add("UserName='" + user.getUserName()+"'");
        codition.add("Password='" + user.getPassWord()+"'");
        //Bang muon truy van
        String tableName = "Account";
        ArrayList<HashMap<String, Object>> records = new InvokeSelectQuery().getList(colums, tableName, codition);
        //add gia tri
        if (records.size()==1) {
            user.setIsLogged(true);
        }

    }
}
